﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel.DataAnnotations;
using VehicleMaintenance.Comm;

namespace VehicleMaintenance.Models
{
    public class PurchaseBill
    {
        [Key]
        public int ID { get; set; }

        [Display(Name="进货单号")]
        [Required(ErrorMessage="进货单号不能为空")]
        public string Code { get; set; }

        [Display(Name = "仓库")]
        public string Position { get; set; }

        [Display(Name = "供应商")]
        public string Suppliers { get; set; }

        [Display(Name = "联系电话")]
        public string TelePhone { get; set; }

        [Display(Name = "进货日期")]
        [ControlTypeAttribute(Type = "DateTimePicker")]
        public string Date { get; set; }        

        [Display(Name = "商品编号")]
        [Required(ErrorMessage = "商品编号不能为空")]
        public int GoodID { get; set; }

        [Display(Name = "商品名称")]
        [Required(ErrorMessage = "商品名称不能为空")]
        public string GoodName { get; set; }

        [Display(Name = "车型")]
        [Required(ErrorMessage = "车型不能为空")]
        public int CarTypeID { get; set; }

        [Display(Name = "进货数量")]
        [Required(ErrorMessage = "进货数量不能为空")]
        public int Number { get; set; }

        [Display(Name = "计量单位")]
        public string Units { get; set; }        

        [Display(Name = "进价")]
        [Required(ErrorMessage = "进价不能为空")]
        public decimal PurchasePrice { get; set; }

        [Display(Name = "零售价")]
        [Required(ErrorMessage = "零售价不能为空")]
        public decimal RetailPrice { get; set; }

        [Display(Name = "批发价")]
        public decimal WholesalePrice { get; set; }

		[Display(Name = "共优惠金额")]
		public decimal OfferAmount { get; set; }

		[Display(Name = "应付")]
		[Required(ErrorMessage = "应付金额不能为空")]
		public decimal TotalPrice { get; set; }

        [Display(Name = "付款方式")]
        [ControlTypeAttribute(Type = "ComboBox", Values = new string[] { "现金" })]
        public string Payment { get; set; }

		[Display(Name = "是否付款")]
		[ControlTypeAttribute(Type = "ComboBox", Values = new string[] { "是","否" })]
		public string IsSettle { get; set; }

        [Display(Name = "业务员")]
        [Required(ErrorMessage = "业务员不能为空")]
        public int StaffID { get; set; }

        [Display(Name = "产地")]
        public string PlaceOfOrigin { get; set; }

        [Display(Name = "备注")]
        public string Remark { get; set; }

        public Goods Good { get; set; }

        public CarType CarType { get; set; }

        public Staff Staff { get; set; }
    }
}
